#include"comm.hpp"


int  GetShmid()
{
    key_t key = GetKey();
    int shmid = shmget(key, size, IPC_CREAT);
    if (shmid < 0)
    {
        cout << "shmget failed" << "  " << __FILE__ << __LINE__ << endl;
        exit(1);
    }
    return shmid;
}

int main()
{
    int shmid = GetShmid();
    char* str = (char*)shmat(shmid, nullptr, 0);
    if (str == nullptr)
    {
        cout << "shmat failed" << "  " << __FILE__ << __LINE__ << endl;
        exit(1);
    }
    for (char i = 'a'; i <= 'z'; i++)
    {
        str[i - 'a'] = i;
        cout << str << endl;
        sleep(1);
    }
    return 0;
}